<template>
  <div class="personal">
    <router-link to="/editProfile">
      <div class="profile">
        <img :src="userInfo.head_img | avatarFilter" alt />
        <div class="profile-center">
          <div class="name">
            <span
              class="iconfont"
              :class="{
                iconxingbienan: userInfo.gender === 1,
                iconxingbienv: userInfo.gender === 0,
              }"
            ></span
            >{{ userInfo.nickname }}
          </div>
          <div class="time">{{ userInfo.create_date | dateFilter }}</div>
        </div>
        <span class="iconfont iconjiantou1"></span>
      </div>
    </router-link>
    <!-- 点击我的关注跳到关注用户页面 -->
    <van-cell title="我的关注" is-link value="关注的用户" to="/followUser" />
    <van-cell title="我的跟帖" is-link value="跟帖/回复" />
    <!-- 点击我的收藏跳转到我的收藏页面 -->
    <van-cell title="我的收藏" is-link value="文章/视频" to="myCollect" />
    <van-cell title="设置" />
    <div class="exit-btn">
      <van-button
        round
        block
        type="primary"
        native-type="submit"
        color="#EB6112"
        >退出</van-button
      >
    </div>
  </div>
</template>

<script>
import { getUser } from "../api/user";
export default {
  data() {
    return {
      userInfo: {},
    };
  },
  created() {
    getUser().then((res) => {
      this.userInfo = res.data.data;
    });
  },
};
</script>

<style lang='less' scoped>
.personal {
  width: 100vw;
  height: 100vh;
  background-color: #eee;
}
a {
  color: #666;
}
.profile {
  display: flex;
  padding: 20px 10px;
  justify-content: space-between;
  align-items: center;
  border-bottom: 5px #ddd solid;

  img {
    width: (70 / 360) * 100vw;
    height: (70 / 360) * 100vw;
    border-radius: 50%;
  }

  .profile-center {
    flex: 1;
    padding: 0 10px;
  }

  .name {
    span {
      color: #75b9eb;
    }
  }

  .time {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
  }
}
// 重置背景色样式
.van-cell {
  background-color: transparent;
  font-size: 20px;
}

.van-cell::after {
  display: block;
  border-color: #666;
}

.exit-btn {
  margin-top: 16px;
  margin-left: 16px;
  margin-right: 16px;
}
</style>